<?php
/**
 * Functions.php
 *
 */

//echo how many comments a post has, formatted with markup
//must be called from within the loop or query_posts
function comments_indicator() {
	$commentsStr;
	$nComments = get_comments_number();
	
	if( $nComments == 0 ) {
		$commentsStr = "Comments"; 
	} elseif( $nComments == 1 ) {
		$commentsStr = "Comment";
	} else {
		$commentsStr = "Comments";
	}
	
	echo "<dl><dt>".$nComments."</dt><dd>".$commentsStr."</dd></dl>";
}

//make comment author link have target="_blank"
function custom_get_comment_author_link($ignore = 'http://Website') {
	$url    = get_comment_author_url();
	$author = get_comment_author();

	if ( empty( $url ) || 'http://' == $url || $ignore == $url )
		$return = $author;
	else
		$return = "<a href='$url' rel='external nofollow' class='url' target='_blank'>$author</a>";
	return apply_filters('get_comment_author_link', $return);
}

function custom_comment_author_link() {
	echo custom_get_comment_author_link();
}

//Handles wp widget configuration
//Register Widgets
if ( function_exists( 'register_sidebars' ) ) {
	register_sidebar(array(
		'name'=>'Sidebar',
		'before_widget' => '<div class="widget">',
		'after_widget' => '</div>',
		'before_title' => '<h3>',
		'after_title' => '</h3>',
	));
}

?>